import React, { Component } from 'react';
import { Button } from 'antd';

interface Geeting {
  name?: string;
}

interface State {
  count: number;
}

class HelloClass extends Component<Geeting, State> {

  constructor(props: Geeting) {
    super(props);
    this.state = {
      count: 0
    }
  }
  
  handleClick = (): void => {
    this.setState({
      count: this.state.count + 1
    })
  }
  render() {
    const { count } = this.state;
    const { name } = this.props;
    return (
      <>
        <p> { count } </p>
        <Button type="primary" onClick={this.handleClick}> { name } </Button>
      </>
    )
  }
}

export default HelloClass;